//
//  PYFileManager.h
//  PictureYourself
//
//  Created by Daniel on 27/7/12.
//
//

#import <CoreMedia/CoreMedia.h>
#import <Foundation/Foundation.h>
#import <sys/time.h>
#import <sys/dirent.h>
#import <dirent.h>
#import <stdio.h>
#import <stdlib.h>
#import <string.h>
#import <sys/types.h>
#import <sys/stat.h>

#import "CGGImage.h"

#define TM_BASE_YEAR 1900

typedef void(^imageFound)(NSURL*);
typedef void(^directoryFound)(NSURL*);

static NSString *kExtensionAttachments = @"attachments";
static NSString *kExtensionImage = @"image";
static NSString *kExtensionThumbnail = @"thumbnail";

@interface PYFileManager : NSObject
{
    BOOL initialized_;
    NSURL *capturedImageDataCurrentDirectory_;
    NSMutableArray *imageUrlWithoutExtArray_;
}

// Should be called once when on application start.
+(void)initialize;

// A Singleton instance
+(PYFileManager*)instance;

-(NSString*)saveImageData:(NSData *)imageData attachments:(NSDictionary*)attachments;

-(BOOL)getImageData:(NSData **)imageData andAttachments:(NSDictionary **)attachments fromName:(NSString*)name;
-(CGImageRef)copyLatestThumbnail:(NSDictionary**)properties;
-(CGImageRef)copyThumbnailAtIndex:(NSUInteger)index:(NSDictionary**)properties;
-(CGImageRef)newImageFromIndex:(NSUInteger)index imageType:(NSString*)extension dictionary:(NSDictionary**)properties;

@property (readonly) NSInteger imageCount;

@end
